package cn.kgc.shiroday03.util;

import java.util.Random;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/6/3
 * @Description: 随机盐工具类
 */
public class SaltUtil {

    public static String getSalt(Integer length) {
        char[] chars = "zxcvbnmasdfghjklqwertyuiopQWERTYUIOPASDFGHJKLZXCVBNM1234567890,.;[]".toCharArray();
        Random random = new Random();

        StringBuilder stringBuilder = new StringBuilder();
        for (Integer integer = 0; integer < length; integer++) {
            int index = random.nextInt(chars.length);
            stringBuilder.append(chars[index]);
        }
        return stringBuilder.toString();
    }
}
